/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("tb_project_billing_allocation",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using MYData.Entity.DomainModels;
using MYData.System.IServices;
using System.Net;
using MYData.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using MYData.Entity.DomainModels.ApiEntity.Input;

namespace MYData.System.Controllers
{
    public partial class tb_project_billing_allocationController
    {
        private readonly Itb_project_billing_allocationService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public tb_project_billing_allocationController(
            Itb_project_billing_allocationService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        /// <summary>
        /// 经费下拨明细列表(项目基础信息表+入账单表+流程表)
        /// </summary>
        /// <returns></returns>
        [HttpGet, Route("list")]
        [AllowAnonymous]
        public async Task<WebResponseContent> GetAllocation(string id)
        {
            return await _service.GetAllocation(id);
        }

        /// <summary>
        /// 根据基础信息主键显示经费下拨表详情信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// WJQ 2023/4/11
        [HttpGet, Route("basicBillingDetail")]
        [AllowAnonymous]
        public async Task<WebResponseContent> basicBillingDetail(string id)
        {
            return await _service.basicBillingDetail(id);
        }

        /// <summary>
        /// 经费分配详情信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// WJQ 2023/4/11
        [HttpGet, Route("billingAllocationDetail")]
        [AllowAnonymous]
        public async Task<WebResponseContent> billingAllocationDetail(string id)
        {
            return await _service.billingAllocationDetail(id);
        }

        /// <summary>
        /// 经费分配添加
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("basicBillingAdd")]
        [AllowAnonymous]
        public async Task<WebResponseContent> basicBillingAdd([FromBody]basicallocationInput_Dto inputdto)
        {
            return await _service.basicBillingAdd(inputdto);
        }
    }
}
